//
//  RewritingNavigationController.m
//  bag366Mobile
//
//  Created by tanw on 16/8/26.
//  Copyright © 2016年 bag366. All rights reserved.
//

#import "RewritingNavigationController.h"

#import "MainTabBarViewController.h"

@interface RewritingNavigationController(){
    MainTabBarViewController *mainTabBarView;
}



@end

@implementation RewritingNavigationController 

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController {
    self = [super initWithRootViewController:rootViewController];
    if (self) {
        self.delegate = self;
        self.navigationBar.translucent = YES;
        //状态栏颜色
        UIView* statusBarInterceptView = [[UIView alloc] initWithFrame:[UIApplication sharedApplication].statusBarFrame];
        statusBarInterceptView.backgroundColor=[UIColor blackColor];
        [self.view addSubview:statusBarInterceptView];
    }
    return self;
}
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if ([viewController isKindOfClass:[MainTabBarViewController class]]) {
        [self setNavigationBarHidden:YES];
        [self.navigationBar setHidden:YES];
    }else {
        [self setNavigationBarHidden:NO];
        [self.navigationBar setHidden:NO];
    }
}

-(BOOL)prefersStatusBarHidden {
    return YES;
}

@end
